package org.jeecg.modules.demo.shopcommoditycart.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.demo.shopcommoditycart.entity.ShopCommodityCart;
import org.jeecg.modules.demo.shopcommoditycart.mapper.ShopCommodityCartMapper;
import org.jeecg.modules.demo.shopcommoditycart.service.IShopCommodityCartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @Description: 商品购物车
 * @Author: jeecg-boot
 * @Date: 2022-01-14
 * @Version: V1.0
 */
@Service
public class ShopCommodityCartServiceImpl extends ServiceImpl<ShopCommodityCartMapper, ShopCommodityCart> implements IShopCommodityCartService {
    @Autowired
    private ShopCommodityCartMapper shopCommodityCartMapper;

    // 商品数量加1
    @Override
    public void addQty(String id) {
        shopCommodityCartMapper.addQty(id);
    }

    // 商品数量减1
    @Override
    public void reduceQty(String id) {
        shopCommodityCartMapper.reduceQty(id);
    }

    // 修改商品数量
    @Override
    public void updateQty(String id, Integer qty) {
        shopCommodityCartMapper.updateQty(id, qty);
    }

    // 查询购物车商品列表
    @Override
    public List<Map<String, Object>> getListByMemberId(Integer pageNo, Integer pageSize, String storeId, String memberId) {
        return shopCommodityCartMapper.getListByMemberId(pageNo - 1, pageSize, storeId, memberId);
    }
}
